\floatname{algorithm}{Algoritmo}
\renewcommand{\algorithmicrequire}{\textbf{Input:}}
\renewcommand{\algorithmicensure}{\textbf{Output:}}


\begin{algorithm}
\caption{\textsc{Processamento-Total}}
\label{alg:tt}
\begin{algorithmic}
\REQUIRE $\mathcal{J}$: conjunto de jobs
\ENSURE jobs ordenados por tempo total de processamento
\STATE $L \leftarrow \mathcal{J}$
\STATE \textsc{Ordenar}($L$)  \qquad\qquad\qquad
        (* $a < b \Rightarrow \tau_{1a} + \tau_{2a} \leq \tau_{1b} + \tau_{2b}$ *)
\RETURN $L$
\end{algorithmic}
\end{algorithm}


\begin{algorithm}
\caption{\textsc{Johnson}}
\label{alg:john}
\begin{algorithmic}
\REQUIRE $\mathcal{J}$: conjunto de jobs
\ENSURE permutação com menor $f'$
\STATE $L_1 \leftarrow \{j \in \mathcal{J} | \tau_{1j} < \tau_{2j}\}$
\STATE $L_2 \leftarrow \{j \in \mathcal{J} | \tau_{1j} \geq \tau_{2j}\}$
\STATE \textsc{Ordenar}($L_1$)  \qquad\qquad\qquad
        (* $a < b \Rightarrow \tau_{1a} \leq \tau_{1b}$ *)
\STATE \textsc{Ordenar}($L_2$)  \qquad\qquad\qquad
        (* $a < b \Rightarrow \tau_{2a} \geq \tau_{2b}$ *)
\RETURN $L_1 \bigcup L_2$
\end{algorithmic}
\end{algorithm}


\begin{algorithm}
\caption{\textsc{Hill-Climbing}}
\label{alg:hc}
\begin{algorithmic}
\REQUIRE $S$: estado inicial
\ENSURE estado que é máximo local
\STATE \textit{atual} $\leftarrow $ $S$
\LOOP
    \STATE \textit{vizinho} $\leftarrow$ sucessor de \textit{atual} com menor valor
    \IF{\textsc{Valor}(\textit{vizinho}) $\geq$ \textsc{Valor}(\textit{atual})}
        \RETURN \textit{atual}
    \ENDIF
    \STATE \textit{atual} $\leftarrow$ \textit{vizinho}
\ENDLOOP

\end{algorithmic}
\end{algorithm}


\begin{algorithm}
\caption{\textsc{Randomizar}}
\label{alg:rand}
\begin{algorithmic}
\REQUIRE $\mathcal{J}$: conjunto de jobs
\ENSURE permutação aleatória
\STATE $L \leftarrow \mathcal{J}$
\FOR{$i \leftarrow 1$ to $|\mathcal{J}|$}
\STATE $k \leftarrow$ número aleatório com $i \leq k \leq |\mathcal{J}|$
\STATE trocar $L[i]$ e $L[k]$
\ENDFOR
\RETURN $L$
\end{algorithmic}
\end{algorithm}


\begin{algorithm}
\caption{\textsc{GRASP}}
\label{alg:grasp}
\begin{algorithmic}
\REQUIRE $\mathcal{J}$: conjunto de jobs
\ENSURE melhor solução encontrada
\STATE $S \leftarrow L \leftarrow \mathcal{J}$
\FOR{$i \leftarrow 1$ to $|\mathcal{J}|^3$}
\STATE $L \leftarrow$ \textsc{Randomizar}($L$)
\STATE $L \leftarrow$ \textsc{Hill-Climbing($L$)}
    \IF{\textsc{Valor}($L$) < \textsc{Valor}($S$)}
    \STATE $S \leftarrow L$ 
    \ENDIF
\ENDFOR
\RETURN $S$
\end{algorithmic}
\end{algorithm}

